import global_var
import os

from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWebEngineWidgets import QWebEngineView

import ctypes

import platform



class Ui_PDS_Window(object):

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.setWindowModality(QtCore.Qt.NonModal)
        MainWindow.resize(981, 650)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
        MainWindow.setSizePolicy(sizePolicy)
        MainWindow.setMinimumSize(QtCore.QSize(981, 650))
        MainWindow.setMaximumSize(QtCore.QSize(981, 650))
        MainWindow.setMouseTracking(False)
        MainWindow.setStyleSheet("QMainWIndow#MainWindow{\n"
                                 "border-width: 10px;\n"
                                 "border-radius: 100px;\n"
                                 "}\n"
                                 "QStackedWidget#stackedWidget{\n"
                                 "border-bottom-right-radius: 10px;\n"
                                 "}\n"
                                 "\n"
                                 "QWidget#centralwidget{\n"
                                 "background-color:transparent;\n"
                                 "}\n"
                                 "QFrame#frame{\n"
                                 "background-color: rgb(238, 245, 249);\n"
                                 "border-radius: 10px;\n"
                                 "\n"
                                 "}\n"
                                 "QWidget#navigation{            /*navigation bar*/\n"
                                 "background-color:rgba(0, 50, 128, 200);\n"
                                 "border-bottom-left-radius: 10px;\n"
                                 "}\n"
                                 "QWidget#widget_2{        /*icon bar*/\n"
                                 "background-color:rgba(0, 50, 128, 170);\n"
                                 "border-top-left-radius: 10px;\n"
                                 "}\n"
                                 "\n"
                                 "QWidget#widget_15{        /*放search bar*/\n"
                                 "background-color:rgb(229, 232, 233)\n"
                                 "}\n"
                                 "\n"
                                 "QWidget#widget_17{        /*放两个小圆按钮*/\n"
                                 "background-color:rgb(229, 232, 233);\n"
                                 "border-top-right-radius: 10px;\n"
                                 "}\n"
                                 "\n"
                                 "QLabel#label_4{             /*icon*/\n"
                                 "background-color: rgba(255, 255, 255,0);  /*transparent*/\n"
                                 "}\n"
                                 "\n"
                                 "QLabel#label_3{     /*GUI Chart*/\n"
                                 "color:rgba(255, 255, 255, 200);\n"
                                 "font-size:16px;\n"
                                 "font-family:'LiSu';\n"
                                 "}\n"
                                 "\n"
                                 "QLabel#label_5{     /*V 0.2.2*/\n"
                                 "color:rgba(255, 255, 255, 200);\n"
                                 "font-size:14px;\n"
                                 "font-family:微软雅黑;\n"
                                 "}\n"
                                 "\n"
                                 "QLineEdit#lineEdit_4{     /*search bar*/\n"
                                 "color:rgba(100, 88, 117,250);\n"
                                 "font-size:15px;\n"
                                 "font: bold \"Times New Roman\";\n"
                                 "border-width: 2px;\n"
                                 "border-radius: 16px;\n"
                                 "}\n"
                                 "\n"
                                 "\n"
                                 "QPushButton#pushButton_16{  /*search button*/\n"
                                 "background-color:rgba(30, 249, 251, 50);\n"
                                 "color:white;\n"
                                 "font-size:16px;\n"
                                 "border-width: 2px;\n"
                                 "border-radius: 16px;\n"
                                 "font-family: 微软雅黑;\n"
                                 "}\n"
                                 "QPushButton#pushButton_16:hover{\n"
                                 "background:rgba(30, 249, 251, 100);\n"
                                 "}\n"
                                 "QPushButton#pushButton_16:pressed{\n"
                                 "background:rgba(30, 230, 230, 150);\n"
                                 "border: 1px solid #3C3C3C!important;\n"
                                 "}\n"
                                 "\n"
                                 "\n"
                                 "QPushButton#pushButton_12{  /*hamburger*/\n"
                                 "background-color:rgba(250, 249, 251, 60);\n"
                                 "border-radius:10px;\n"
                                 "}\n"
                                 "\n"
                                 "QPushButton#pushButton_13{\n"
                                 "background-color:rgba(138, 128, 200,100);\n"
                                 "color:white;\n"
                                 "font-size:16px;\n"
                                 "font-family: 微软雅黑;\n"
                                 "}\n"
                                 "\n"
                                 "QPushButton#pushButton_13, #pushButton_15{        /*sign out*/\n"
                                 "background-color:rgba(138, 128, 200,100);\n"
                                 "color:white;\n"
                                 "font-size:16px;\n"
                                 "font-family: 微软雅黑;\n"
                                 "}\n"
                                 "\n"
                                 "QPushButton#pushButton_13:hover,#pushButton_15:hover{        /*sign out*/\n"
                                 "background:rgba(250, 249, 251, 100);\n"
                                 "}\n"
                                 "\n"
                                 "QPushButton#pushButton_13:pressed,#pushButton_15:pressed{    \n"
                                 "background:rgba(230, 230, 230, 150);\n"
                                 "border: 1px solid #3C3C3C!important;\n"
                                 "}\n"
                                 "\n"
                                 "QPushButton#pushButton_2,#pushButton_3,#pushButton_4,#pushButton_5,#pushButton_6{  /*dashboard buttons*/\n"
                                 "background-color:rgba(250, 249, 251, 60);\n"
                                 "color:rgba(255,255,255,255);\n"
                                 "font-size:18px;\n"
                                 "border-width: 2px;\n"
                                 "border-radius: 16px;\n"
                                 "font-family:'SimHei';\n"
                                 "}\n"
                                 "QPushButton#pushButton_2:hover,#pushButton_3:hover,#pushButton_4:hover,#pushButton_5:hover,#pushButton_6:hover{/*鼠标移到dashboard 按钮*/\n"
                                 "background:rgba(250, 249, 251, 100);\n"
                                 "}\n"
                                 "QPushButton#pushButton_2:pressed,#pushButton_3:pressed,#pushButton_4:pressed,#pushButton_5:pressed,#pushButton_6:pressed{        /*dashboard 按钮按下*/\n"
                                 "background:rgba(230, 230, 230, 150);\n"
                                 "border: 1px solid #3C3C3C!important;\n"
                                 "}\n"
                                 "\n"
                                 "QPushButton#pushButton_2:open,#pushButton_3:open,#pushButton_4:open,#pushButton_5:open,#pushButton_6:open{        /*dashboard 按钮选中*/\n"
                                 "background:rgb(229, 232, 233);\n"
                                 "color:rgba(0, 50, 128, 230);\n"
                                 "border-bottom-right-radius: 0px;\n"
                                 "border-top-right-radius: 0px;\n"
                                 "border: 0px solid #3C3C3C!important;\n"
                                 "}\n"
                                 "\n"
                                 "/*缩小按钮*/\n"
                                 "QPushButton#pushButton_10,#pushButton_11,#pushButton_7,#pushButton_8,#pushButton_9{  /*dashboard buttons*/\n"
                                 "background-color:rgba(250, 249, 251, 60);\n"
                                 "color:white;\n"
                                 "font-size:16px;\n"
                                 "border-width: 4px;\n"
                                 "border-radius: 16px;\n"
                                 "font-family: 微软雅黑;\n"
                                 "}\n"
                                 "QPushButton#pushButton_10:hover,#pushButton_11:hover,#pushButton_7:hover,#pushButton_8:hover,#pushButton_9:hover{/*鼠标移到dashboard 按钮*/\n"
                                 "background:rgba(250, 249, 251, 100);\n"
                                 "}\n"
                                 "QPushButton#pushButton_10:pressed,#pushButton_11:pressed,#pushButton_7:pressed,#pushButton_8:pressed,#pushButton_9:pressed{        /*dashboard 按钮按下*/\n"
                                 "background:rgba(230, 230, 230, 150);\n"
                                 "border: 1px solid #3C3C3C!important;\n"
                                 "}\n"
                                 "\n"
                                 "QPushButton#pushButton_10:open,#pushButton_11:open,#pushButton_7:open,#pushButton_8:open,#pushButton_9:open{        /*dashboard 按钮选中*/\n"
                                 "background:rgba(230, 230, 230, 175);\n"
                                 "border: 1px solid #3C3C3C!important;\n"
                                 "}\n"
                                 "/*缩小按钮*/\n"
                                 "\n"
                                 "QWidget#widget_7,#widget_3,#widget_4,#widget_5,#widget_6,#widget_18,#widget_19,#widget_20{\n"
                                 "background:white\n"
                                 "}\n"
                                 "\n"
                                 "QWidget#widget_10,#widget_8,#widget_9{ /*menu page*/\n"
                                 "background:white\n"
                                 "}\n"
                                 "\n"
                                 "QWidget#widget_11,#widget_12,#widget_13,#widget_14{ /*chart page*/\n"
                                 "background:white\n"
                                 "}\n"
                                 "\n"
                                 "QWidget#page,#page_2,#page_3,#page_4{            /*每一页page*/\n"
                                 "background:rgb(229, 232, 233)\n"
                                 "}\n"
                                 "\n"
                                 "QPushButton#pushButton_14{        /*退出按钮*/\n"
                                 "background:#CE0000;\n"
                                 "color:white;\n"
                                 "font-size:16px;\n"
                                 "border-radius: 8px;\n"
                                 "font-family: 微软雅黑;\n"
                                 "}\n"
                                 "QPushButton#pushButton_14:hover{                 \n"
                                 "background:#FF2D2D;\n"
                                 "}\n"
                                 "QPushButton#pushButton_14:pressed{\n"
                                 "border: 1px solid #3C3C3C!important;\n"
                                 "background:#AE0000;\n"
                                 "}\n"
                                 "\n"
                                 "QPushButton#pushButton{    /*最小化按钮*/\n"
                                 "background:rgba(108, 108, 108,160);\n"
                                 "color:white;\n"
                                 "font-size:16px;border-radius: 8px;font-family: 微软雅黑;\n"
                                 "}\n"
                                 "QPushButton#pushButton:hover{                 \n"
                                 "background:#9D9D9D;\n"
                                 "}\n"
                                 "QPushButton#pushButton:pressed{\n"
                                 "border: 1px solid #3C3C3C!important;\n"
                                 "}\n"

                                 "QLabel#label_8,#label_11,#label_12,#label_13,#label_31{  /*page_4 label*/\n"
                                 "font-size: 18px;\n"
                                 "color:black;\n"
                                 "font-family:微软雅黑;\n"
                                 "}\n"
                                 "\n"
                                 "QLabel#label_2,#label_18,#label_19,#label_20,#label_21,#label_22,#label_23,#label_24,#label_25,#label_26,#label_14,#label_37{  /*page_2 label*/\n"
                                 "font-size: 20px;\n"
                                 "color:black;\n"
                                 "font-family:微软雅黑;\n"
                                 "}\n"
                                 "\n"
                                 "QLabel#label_32,#label_7{  /*所有节点 label*/\n"
                                 "font-size: 22px;\n"
                                 "color:black;\n"
                                 "font-family:微软雅黑;\n"
                                 "}\n"
                                 "\n"               
                                 "QPushButton#pushButton_17{\n"
                                 "background:rgba(0, 50, 128, 140);\n"
                                 "color:black;\n"
                                 "border-radius: 50px;\n"
                                 "font-family: 微软雅黑;\n"
                                 "font-size:20px;\n"
                                 "}\n"
                                 "QPushButton#pushButton_17:hover{\n"
                                 "background:rgba(0, 50, 128, 160);\n"
                                 "}\n"
                                 "QPushButton#pushButton_17:pressed{\n"
                                 "background:rgba(0, 50, 128, 180);\n"
                                 "}\n"
                                 "\n"
                                 "QPushButton#pushButton_17:open{\n"
                                 "background:rgba(0, 50, 128, 200);\n"
                                 "}\n"
                                 "\n"
                                 "QPushButton#button{\n"
                                 "background:rgba(0, 50, 128, 140);\n"
                                 "color:black;\n"
                                 "border-radius: 50px;\n"
                                 "font-family: 微软雅黑;\n"
                                 "font-size:18px;\n"
                                 "}\n"
                                 "QPushButton#button:hover{\n"
                                 "background:rgba(0, 50, 128, 160);\n"
                                 "}\n"
                                 "QPushButton#button:pressed{\n"
                                 "background:rgba(0, 50, 128, 180);\n"
                                 "}\n"
                                 "\n"
                                 "QPushButton#button:open{\n"
                                 "background:rgba(0, 50, 128, 180);\n"
                                 "color:white;\n"
                                 "}\n"
                                 "\n"
                                 "\n")
        MainWindow.setAnimated(True)
        MainWindow.setDocumentMode(False)
        MainWindow.setDockNestingEnabled(False)
        
 
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setContextMenuPolicy(QtCore.Qt.PreventContextMenu)
        self.centralwidget.setObjectName("centralwidget")
        
        self.frame = QtWidgets.QFrame(self.centralwidget)
        self.frame.setGeometry(QtCore.QRect(0, 0, 981, 650))
        self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame.setObjectName("frame")

        self.widget_2 = QtWidgets.QWidget(self.frame)
        self.widget_2.setGeometry(QtCore.QRect(0, 0, 171, 90))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.widget_2.sizePolicy().hasHeightForWidth())
        self.widget_2.setSizePolicy(sizePolicy)
        self.widget_2.setStyleSheet("")
        self.widget_2.setObjectName("widget_2")

        self.label_3 = QtWidgets.QLabel(self.widget_2)
        self.label_3.setGeometry(QtCore.QRect(70, 10, 140, 50))
        self.label_3.setScaledContents(True)
        self.label_3.setObjectName("label_3")
        self.label_4 = QtWidgets.QLabel(self.widget_2)
        self.label_4.setGeometry(QtCore.QRect(0, 15, 80, 60))
        self.label_4.setAutoFillBackground(False)
        self.label_4.setText("")
        self.label_4.setPixmap(QtGui.QPixmap(global_var.get_value('direction') + "pic" + os.sep + "pic0.png"))
        self.label_4.setScaledContents(True) 
        self.label_5 = QtWidgets.QLabel(self.widget_2)
        self.label_5.setGeometry(QtCore.QRect(80, 62, 71, 21))
        self.label_5.setScaledContents(True)
        self.label_5.setObjectName("label_5")
        
        self.navigation = QtWidgets.QWidget(self.frame)
        self.navigation.setGeometry(QtCore.QRect(0, 90, 171, 552))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.navigation.sizePolicy().hasHeightForWidth())
        self.navigation.setSizePolicy(sizePolicy)
        font = QtGui.QFont()
        font.setPointSize(2)
        font.setBold(False)
        font.setItalic(True)
        font.setWeight(50)
        self.navigation.setFont(font)
        self.navigation.setStyleSheet("")
        self.navigation.setObjectName("navigation")
        
        self.pushButton_12 = QtWidgets.QPushButton(self.navigation)
        self.pushButton_12.setGeometry(QtCore.QRect(120, 10, 40, 40))
        self.pushButton_12.setText("")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(global_var.get_value('direction') + "pic" + os.sep + "shrink.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_12.setIcon(icon)
        self.pushButton_12.setIconSize(QtCore.QSize(30, 30))
        self.pushButton_12.setObjectName("pushButton_12")
        self.pushButton_12.setToolTip("收缩/展开侧边栏")
        
        self.widget = QtWidgets.QWidget(self.navigation)
        self.widget.setGeometry(QtCore.QRect(-1, 70, 171, 351))
        self.widget.setAutoFillBackground(False)
        self.widget.setObjectName("widget")
        
        self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.widget)
        self.horizontalLayout_5.setContentsMargins(2, 2, 2, 2)
        self.horizontalLayout_5.setSpacing(2)
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setContentsMargins(3, 15, 3, 45)
        self.verticalLayout.setSpacing(40)
        self.verticalLayout.setObjectName("verticalLayout")
        
        self.pushButton_2 = QtWidgets.QPushButton(self.widget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.pushButton_2.sizePolicy().hasHeightForWidth())
        self.pushButton_2.setSizePolicy(sizePolicy)
        self.pushButton_2.setMaximumSize(QtCore.QSize(165, 100))
        self.pushButton_2.setStyleSheet("")
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(global_var.get_value('direction') + "pic" + os.sep + "button1.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_2.setIcon(icon2)
        self.pushButton_2.setIconSize(QtCore.QSize(30, 30))
        self.pushButton_2.setCheckable(True)
        self.pushButton_2.setChecked(False)
        self.pushButton_2.setFlat(False)
        self.pushButton_2.setObjectName("pushButton_2")
        self.verticalLayout.addWidget(self.pushButton_2)
        
        self.pushButton_3 = QtWidgets.QPushButton(self.widget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.pushButton_3.sizePolicy().hasHeightForWidth())
        self.pushButton_3.setSizePolicy(sizePolicy)
        self.pushButton_3.setMaximumSize(QtCore.QSize(165, 100))
        self.pushButton_3.setStyleSheet("")
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap(global_var.get_value('direction') + "pic" + os.sep + "button2.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_3.setIcon(icon4)
        self.pushButton_3.setIconSize(QtCore.QSize(30, 30))
        self.pushButton_3.setCheckable(True)
        self.pushButton_3.setObjectName("pushButton_3")
        self.verticalLayout.addWidget(self.pushButton_3)
    
        self.pushButton_4 = QtWidgets.QPushButton(self.widget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.pushButton_4.sizePolicy().hasHeightForWidth())
        self.pushButton_4.setSizePolicy(sizePolicy)
        self.pushButton_4.setMaximumSize(QtCore.QSize(165, 100))
        self.pushButton_4.setStyleSheet("")
        icon5 = QtGui.QIcon()
        icon5.addPixmap(QtGui.QPixmap(global_var.get_value('direction') + "pic" + os.sep + "button3.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_4.setIcon(icon5)
        self.pushButton_4.setIconSize(QtCore.QSize(30,30))
        self.pushButton_4.setCheckable(True)
        self.pushButton_4.setObjectName("pushButton_4")
        self.verticalLayout.addWidget(self.pushButton_4)
        self.horizontalLayout_5.addLayout(self.verticalLayout)
        
        self.widget_16 = QtWidgets.QWidget(self.navigation)
        self.widget_16.setGeometry(QtCore.QRect(0, 50, 43, 351))
        self.widget_16.setObjectName("widget_16")
        self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.widget_16)
        self.horizontalLayout_6.setContentsMargins(2, 2, 2, 2)
        self.horizontalLayout_6.setSpacing(2)
        self.horizontalLayout_6.setObjectName("horizontalLayout_6")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout()
        self.verticalLayout_2.setContentsMargins(3, 15, 3, 45)
        self.verticalLayout_2.setSpacing(28)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        
        self.pushButton_7 = QtWidgets.QPushButton(self.widget_16)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.pushButton_7.sizePolicy().hasHeightForWidth())
        self.pushButton_7.setSizePolicy(sizePolicy)
        self.pushButton_7.setMaximumSize(QtCore.QSize(36, 36))
        self.pushButton_7.setStyleSheet("")
        self.pushButton_7.setText("")
        self.pushButton_7.setIcon(icon2)
        self.pushButton_7.setIconSize(QtCore.QSize(28,28))
        self.pushButton_7.setCheckable(True)
        self.pushButton_7.setChecked(False)
        self.pushButton_7.setFlat(False)
        self.pushButton_7.setObjectName("pushButton_7")
        self.verticalLayout_2.addWidget(self.pushButton_7)
        
        self.pushButton_8 = QtWidgets.QPushButton(self.widget_16)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.pushButton_8.sizePolicy().hasHeightForWidth())
        self.pushButton_8.setSizePolicy(sizePolicy)
        self.pushButton_8.setMaximumSize(QtCore.QSize(36, 36))
        self.pushButton_8.setStyleSheet("")
        self.pushButton_8.setText("")
        self.pushButton_8.setIcon(icon4)
        self.pushButton_8.setIconSize(QtCore.QSize(28, 28))
        self.pushButton_8.setCheckable(True)
        self.pushButton_8.setFlat(False)
        self.pushButton_8.setObjectName("pushButton_8")
        self.verticalLayout_2.addWidget(self.pushButton_8)
        
        self.pushButton_9 = QtWidgets.QPushButton(self.widget_16)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.pushButton_9.sizePolicy().hasHeightForWidth())
        self.pushButton_9.setSizePolicy(sizePolicy)
        self.pushButton_9.setMaximumSize(QtCore.QSize(36, 36))
        self.pushButton_9.setStyleSheet("")
        self.pushButton_9.setText("")
        self.pushButton_9.setIcon(icon5)
        self.pushButton_9.setIconSize(QtCore.QSize(28, 28))
        self.pushButton_9.setCheckable(True)
        self.pushButton_9.setObjectName("pushButton_9")
        self.verticalLayout_2.addWidget(self.pushButton_9)
        self.horizontalLayout_6.addLayout(self.verticalLayout_2)
        
        self.widget_15 = QtWidgets.QWidget(self.frame)
        self.widget_15.setGeometry(QtCore.QRect(172, 0, 721, 40))
        self.widget_15.setObjectName("widget_15")
        
        self.widget_17 = QtWidgets.QWidget(self.frame)
        self.widget_17.setGeometry(QtCore.QRect(890, 0, 81, 40))
        self.widget_17.setObjectName("widget_17")
        
        self.pushButton = QtWidgets.QPushButton(self.widget_17)
        self.pushButton.setGeometry(QtCore.QRect(20, 10, 16, 16))
        self.pushButton.setMaximumSize(QtCore.QSize(16777215, 16777191))
        self.pushButton.setText("")
        self.pushButton.setObjectName("pushButton")
        
        self.pushButton_14 = QtWidgets.QPushButton(self.widget_17)
        self.pushButton_14.setGeometry(QtCore.QRect(50, 10, 16, 16))
        self.pushButton_14.setText("")
        self.pushButton_14.setObjectName("pushButton_14")
        
        
        self.stackedWidget = QtWidgets.QStackedWidget(self.frame)
        self.stackedWidget.setGeometry(QtCore.QRect(171, 44, 801, 595))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.stackedWidget.sizePolicy().hasHeightForWidth())
        self.stackedWidget.setSizePolicy(sizePolicy)
        self.stackedWidget.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.stackedWidget.setFrameShadow(QtWidgets.QFrame.Plain)
        self.stackedWidget.setLineWidth(0)
        self.stackedWidget.setMidLineWidth(0)
        self.stackedWidget.setObjectName("stackedWidget")
        


        self.page_4 = QtWidgets.QWidget()
        self.page_4.setObjectName("page_4")
        self.horizontalLayout_7 = QtWidgets.QHBoxLayout(self.page_4)
        self.horizontalLayout_7.setContentsMargins(-1, 3, -1, -1)
        self.horizontalLayout_7.setObjectName("horizontalLayout_7")
        self.verticalLayout_3 = QtWidgets.QVBoxLayout()
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.label_7 = QtWidgets.QLabel(self.page_4)
        self.label_7.setObjectName("label_7")
        self.label_7.setToolTip("基准电压大于10KV")
        self.verticalLayout_3.addWidget(self.label_7)

       
        self.widget_19 = QtWidgets.QWidget(self.page_4)
        self.widget_19.setObjectName("widget_19")


        self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.widget_19)
        self.horizontalLayout_4.setSpacing(5)
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")

        self.treeWidget = QtWidgets.QTreeWidget(self.widget_19)
        self.treeWidget.setObjectName("treeWidget")
        self.horizontalLayout_4.addWidget(self.treeWidget)
        
        self.verticalLayout_3.addWidget(self.widget_19)
        self.verticalLayout_3.setStretch(0, 1)
        self.verticalLayout_3.setStretch(1, 16)
        self.horizontalLayout_7.addLayout(self.verticalLayout_3)
        self.verticalLayout_4 = QtWidgets.QVBoxLayout()
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.widget_20 = QtWidgets.QWidget(self.page_4)
        self.widget_20.setObjectName("widget_20")
        self.label_31 = QtWidgets.QLabel(self.widget_20)
        self.label_31.setGeometry(QtCore.QRect(0, 0, 491, 35))
        self.label_31.setText("")
        self.label_31.setObjectName("label_31")
        self.verticalLayout_4.addWidget(self.widget_20)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.widget_14 = QtWidgets.QWidget(self.page_4)
        self.widget_14.setObjectName("widget_14")
        self.label_29 = QtWidgets.QLabel(self.widget_14)
        self.label_29.setGeometry(QtCore.QRect(10, 10, 301, 181))
        self.label_29.setText("")
        self.label_29.setObjectName("label_29")
        self.horizontalLayout.addWidget(self.widget_14)
        self.widget_13 = QtWidgets.QWidget(self.page_4)
        self.widget_13.setObjectName("widget_13")
        self.label_11 = QtWidgets.QLabel(self.widget_13)
        self.label_11.setGeometry(QtCore.QRect(30, 10, 91, 24))
        self.label_11.setObjectName("label_11")
        self.label_11.setToolTip("分布式光伏承载力是指在满足供电设备和线路不过载、系统各项性能不超标的情况下，配电网可接入的分布式光伏的最大容量。\n当分布式光伏接入容量超过这个限制时，至少会出现一个对配电网来说无法接受的影响。")
        self.label_12 = QtWidgets.QLabel(self.widget_13)
        self.label_12.setGeometry(QtCore.QRect(48, 35, 100, 41))
        self.label_12.setText("")
        self.label_12.setObjectName("label_12")
        self.label_13 = QtWidgets.QLabel(self.widget_13)
        self.label_13.setGeometry(QtCore.QRect(30, 90, 101, 24))
        self.label_13.setObjectName("label_13")
        self.label_28 = QtWidgets.QLabel(self.widget_13)
        self.label_28.setGeometry(QtCore.QRect(58, 120, 60, 60))
        self.label_28.setText("")
        self.label_28.setObjectName("label_28")
        self.horizontalLayout.addWidget(self.widget_13)
        self.horizontalLayout.setStretch(0, 2)
        self.horizontalLayout.setStretch(1, 1)
        self.verticalLayout_4.addLayout(self.horizontalLayout)
        self.widget_12 = QtWidgets.QWidget(self.page_4)
        self.widget_12.setObjectName("widget_12")
        self.label_8 = QtWidgets.QLabel(self.widget_12)
        self.label_8.setGeometry(QtCore.QRect(25, 10, 480, 51))
        self.label_8.setText("")
        self.label_8.setObjectName("label_8")
        self.verticalLayout_4.addWidget(self.widget_12)
        self.widget_11 = QtWidgets.QWidget(self.page_4)
        self.widget_11.setObjectName("widget_11")

        #self.gridlayout_2 = QtWidgets.QGridLayout(self.widget_11)
        self.myHtml = QWebEngineView()
        New_direction = global_var.get_value('direction') + 'files_generated' + os.sep + 'plot.html'
        New_direction = New_direction.replace('\\','/')
        self.myHtml.load(QtCore.QUrl(New_direction))
        #self.myHtml.setZoomFactor(0.5)
        self.myHtml.setToolTip("节点上下级关系树状图")
        #self.gridlayout_2.addWidget(self.myHtml,0,0)
        
        self.verticalLayout_4.addWidget(self.widget_11)
        self.verticalLayout_4.setStretch(0, 1)
        self.verticalLayout_4.setStretch(1, 6)
        self.verticalLayout_4.setStretch(2, 2)
        self.verticalLayout_4.setStretch(3, 8)
        self.horizontalLayout_7.addLayout(self.verticalLayout_4)
        self.horizontalLayout_7.setStretch(0, 1)
        self.horizontalLayout_7.setStretch(1, 2)
        self.stackedWidget.addWidget(self.page_4)
        


        self.page_2 = QtWidgets.QWidget()
        self.page_2.setEnabled(True)
        self.page_2.setToolTipDuration(-1)
        self.page_2.setObjectName("page_2")
        self.horizontalLayout_10 = QtWidgets.QHBoxLayout(self.page_2)
        self.horizontalLayout_10.setContentsMargins(10, 10, 10, 10)
        self.horizontalLayout_10.setSpacing(10)
        self.horizontalLayout_10.setObjectName("horizontalLayout_10")
        self.verticalLayout_1 = QtWidgets.QVBoxLayout(self.page_2)
        self.verticalLayout_1.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_1.setSpacing(10)
        self.verticalLayout_1.setObjectName("verticalLayout_1")

        self.label_32 = QtWidgets.QLabel(self.page_2)
        self.label_32.setText("")
        self.label_32.setObjectName("label_32")
        self.label_32.setToolTip("基准电压大于10KV")
        self.verticalLayout_1.addWidget(self.label_32)
        
        self.widget_4 = QtWidgets.QWidget(self.page_2)
        self.widget_4.setObjectName("widget_4")

        self.horizontalLayout_9 = QtWidgets.QHBoxLayout(self.widget_4)
        self.horizontalLayout_9.setSpacing(5)
        self.horizontalLayout_9.setObjectName("horizontalLayout_9")

        self.treeWidget_2 = QtWidgets.QTreeWidget(self.widget_4)
        self.treeWidget_2.setObjectName("treeWidget_2")
        self.horizontalLayout_9.addWidget(self.treeWidget_2)


        # self.gridlayout = QtWidgets.QGridLayout(self.widget_4)
        # self.gridlayout.setSpacing(10)
        # self.gridlayout.setContentsMargins(10, 10, 10, 10)
        font = QtGui.QFont()
        font.setBold(True)
        font.setItalic(False)
        font.setWeight(50)
        self.widget_4.setFont(font)
        self.verticalLayout_1.addWidget(self.widget_4)
        self.verticalLayout_1.setStretch(0,1)
        self.verticalLayout_1.setStretch(1,18)
        self.horizontalLayout_10.addLayout(self.verticalLayout_1)

        self.verticalLayout_7 = QtWidgets.QVBoxLayout()
        self.verticalLayout_7.setSpacing(10)
        self.verticalLayout_7.setObjectName("verticalLayout_7")

        self.widget_7 = QtWidgets.QWidget(self.page_2)
        self.widget_7.setObjectName("widget_7")
        self.label_37 = QtWidgets.QLabel(self.widget_7)
        self.label_37.setGeometry(QtCore.QRect(30, 6, 432, 25))
        self.label_37.setObjectName("label_37")
        self.verticalLayout_7.addWidget(self.widget_7)

        self.widget_5 = QtWidgets.QWidget(self.page_2)
        self.widget_5.setObjectName("widget_5")
        self.label_2 = QtWidgets.QLabel(self.widget_5)
        self.label_2.setGeometry(QtCore.QRect(30, 20, 101, 71))
        self.label_2.setObjectName("label_2")
        self.label_2.setToolTip("如上级节点评估等级为红色，则所有下级节点评估等级均为红色")
        self.label_21 = QtWidgets.QLabel(self.widget_5)
        self.label_21.setGeometry(QtCore.QRect(150, 20, 64, 64))
        self.label_21.setText("")
        self.label_21.setObjectName("label_21")
        self.label_22 = QtWidgets.QLabel(self.widget_5)
        self.label_22.setGeometry(QtCore.QRect(260, 12, 181, 81))
        self.label_22.setText("")
        self.label_22.setObjectName("label_22")
        self.label_2.raise_()
        self.label_21.raise_()
        self.label_22.raise_()
        self.verticalLayout_7.addWidget(self.widget_5)

        self.widget_6 = QtWidgets.QWidget(self.page_2)
        self.widget_6.setObjectName("widget_6")
        self.label_18 = QtWidgets.QLabel(self.widget_6)
        self.label_18.setGeometry(QtCore.QRect(30, 30, 171, 51))
        self.label_18.setObjectName("label_18")
        self.label_23 = QtWidgets.QLabel(self.widget_6)
        self.label_23.setGeometry(QtCore.QRect(250, 22, 200, 60))
        self.label_23.setText("")
        self.label_23.setObjectName("label_23")
        self.verticalLayout_7.addWidget(self.widget_6)
        
        self.widget_3 = QtWidgets.QWidget(self.page_2)
        self.widget_3.setAutoFillBackground(False)
        self.widget_3.setObjectName("widget_3")
        self.label_19 = QtWidgets.QLabel(self.widget_3)
        self.label_19.setGeometry(QtCore.QRect(30, 30, 171, 51))
        self.label_19.setObjectName("label_19")
        self.label_24 = QtWidgets.QLabel(self.widget_3)
        self.label_24.setGeometry(QtCore.QRect(250, 22, 200, 60))
        self.label_24.setText("")
        self.label_24.setObjectName("label_24")
        self.verticalLayout_7.addWidget(self.widget_3)
        
        self.widget_18 = QtWidgets.QWidget(self.page_2)
        self.widget_18.setAutoFillBackground(False)
        self.widget_18.setObjectName("widget_18")
        self.label_20 = QtWidgets.QLabel(self.widget_18)
        self.label_20.setGeometry(QtCore.QRect(30, 40, 120, 24))
        self.label_20.setObjectName("label_20")
        self.label_25 = QtWidgets.QLabel(self.widget_18)
        self.label_25.setGeometry(QtCore.QRect(240, 30, 101, 41))
        self.label_25.setText("")
        self.label_25.setObjectName("label_25")
        self.label_26 = QtWidgets.QLabel(self.widget_18)
        self.label_26.setGeometry(QtCore.QRect(380, 20, 64, 64))
        self.label_26.setText("")
        self.label_26.setObjectName("label_26")
        self.label_20.raise_()
        self.label_25.raise_()
        self.label_26.raise_()
        self.widget_6.raise_()
        self.widget_4.raise_()
        self.widget_4.raise_()
        self.verticalLayout_7.addWidget(self.widget_18)
        
        self.label_27 = QtWidgets.QLabel(self.page_2)
        self.label_27.setWordWrap(False)
        self.label_27.setObjectName("label_27")
        self.verticalLayout_7.addWidget(self.label_27)
        
        self.horizontalLayout_10.addLayout(self.verticalLayout_7)
        self.horizontalLayout_10.setStretch(0, 1)
        self.horizontalLayout_10.setStretch(1, 2)
        self.verticalLayout_7.setStretch(0,1)
        self.verticalLayout_7.setStretch(1,3)
        self.verticalLayout_7.setStretch(2,3)
        self.verticalLayout_7.setStretch(3,3)
        self.verticalLayout_7.setStretch(4,3)
        self.verticalLayout_7.setStretch(5,1)

        self.stackedWidget.addWidget(self.page_2)
        


        self.page_3 = QtWidgets.QWidget()
        self.page_3.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.page_3.setObjectName("page_3")
        self.horizontalLayout_8 = QtWidgets.QHBoxLayout(self.page_3)
        self.horizontalLayout_8.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout_8.setSpacing(0)
        self.horizontalLayout_8.setObjectName("horizontalLayout_8")

        self.widget_22 = QtWidgets.QWidget(self.page_3)
        self.widget_22.setObjectName("widget_22")
        self.widget_22.setStyleSheet("font-size: 24px;\n"
                                     "font-family:微软雅黑;\n")      

        self.label_33 = QtWidgets.QLabel(self.widget_22)
        self.label_33.setGeometry(QtCore.QRect(0, 38, 40, 30))                          
        self.label_33.setText("")
        self.label_33.setStyleSheet("background-color:white;\n")      
        self.label_34 = QtWidgets.QLabel(self.widget_22)
        self.label_34.setGeometry(QtCore.QRect(0, 228, 40, 30))
        self.label_34.setText("")
        self.label_34.setStyleSheet("background-color:white;\n") 
        self.label_35 = QtWidgets.QLabel(self.widget_22)
        self.label_35.setGeometry(QtCore.QRect(0, 418, 40, 30))
        self.label_35.setText("")
        self.label_35.setStyleSheet("background-color:white;\n") 

        self.horizontalLayout_8.addWidget(self.widget_22)
        self.verticalLayout_5 = QtWidgets.QVBoxLayout()
        self.verticalLayout_5.setObjectName("verticalLayout_5")
        self.verticalLayout_5.setSpacing(10)

        self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.page_3)
        self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout_3.setSpacing(0)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        
        self.pushButton_17 = QtWidgets.QPushButton(self.page_3)
        self.pushButton_17.setObjectName("pushButton_17")
        self.pushButton_17.setText("")
        self.horizontalLayout_3.addItem(spacerItem)
        self.horizontalLayout_3.addWidget(self.pushButton_17)
        self.verticalLayout_5.addLayout(self.horizontalLayout_3)

        self.tableView = QtWidgets.QTableView(self.page_3)
        self.tableView.setObjectName("tableView")
        self.verticalLayout_5.addWidget(self.tableView)
        self.tableView_2 = QtWidgets.QTableView(self.page_3)
        self.tableView_2.setObjectName("tableView_2")
        self.verticalLayout_5.addWidget(self.tableView_2)
        self.tableView_3 = QtWidgets.QTableView(self.page_3)
        self.tableView_3.setObjectName("tableView_3")
        self.verticalLayout_5.addWidget(self.tableView_3)
        self.horizontalLayout_8.addLayout(self.verticalLayout_5)
        self.horizontalLayout_8.setStretch(0,1)
        self.horizontalLayout_8.setStretch(1,18)
        self.stackedWidget.addWidget(self.page_3)
        
        MainWindow.setCentralWidget(self.centralwidget)
        self.actionchar1 = QtWidgets.QAction(MainWindow)
        self.actionchar1.setObjectName("actionchar1")
        MainWindow.setCentralWidget(self.centralwidget)
        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

        mysystem = platform.system()
        if mysystem == 'Windows':
            ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("myappid") #更改应用的DLL
        elif mysystem == 'Darwin':
            pass
        icon = QtGui.QIcon() #创建图标对象
        icon.addPixmap(QtGui.QPixmap(global_var.get_value('direction') + "pic" + os.sep + "icon.ico"),QtGui.QIcon.Normal, QtGui.QIcon.Off) #把图标文件添加到图标对象中
        MainWindow.setWindowIcon(icon)
    
    
            

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        self.label_3.setText(_translate("MainWindow", "分布式光伏\n  承载力\n 评估系统"))
        self.label_5.setText(_translate("MainWindow", "  V 0.2.2"))
        self.pushButton_2.setText(_translate("MainWindow", "  评估结果\n Assessment\n   Result"))
        self.pushButton_3.setText(_translate("MainWindow", "  问题分析\n  Problem\n  Analysis"))
        self.pushButton_4.setText(_translate("MainWindow", "  文件呈现\n  DAT File\n  Display"))
        
        self.label_7.setText(_translate("MainWindow", "             所有节点"))
        self.label_11.setText(_translate("MainWindow", "     承载力"))
        self.label_13.setText(_translate("MainWindow", "    评估等级"))
        
        self.label_2.setText(_translate("MainWindow", "上级节点\n评估等级"))
        self.label_18.setText(_translate("MainWindow", "短路电流校核"))
        self.label_19.setText(_translate("MainWindow", "电压偏差校核"))
        self.label_20.setText(_translate("MainWindow", "反向负载率"))
        self.label_27.setText(_translate("MainWindow", "反向负载率：λ>80% 评估等级为红色\n""反向负载率：0<λ≤80% 评估等级为黄色\n""反向负载率：λ<0 评估等级为绿色      "))
        self.label_32.setText(_translate("MainWindow", "             所有节点"))

        self.pushButton_17.setText(_translate("MainWindow", "输出Excel文档"))
        self.label_33.setText(_translate("MainWindow", "B卡"))
        self.label_34.setText(_translate("MainWindow", "L卡"))
        self.label_35.setText(_translate("MainWindow", "T卡"))